home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EXEC.SWG / 0016_Operating Modes.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  1KB  |  68 lines

  1. {
  2. If you ever wanted to tell what Operating System Mode you are using,
  3. this /ditty/ will do the trick.  It sets a global integer to a value
  4. which represents the Mode being used.  There is also a demo_prog at the
  5. end of the unit.
  6. }
  7.  
  8. unit mode;
  9.  
  10. interface
  11.  
  12. var
  13.   OperatingMode : integer;
  14.  
  15. { This integer holds a value of 0, 1, 2 or 3, which is an indicator
  16.   if the machine is in:
  17.     Dos Mode              (0),
  18.     Windows Standard Mode (1),
  19.     Windows Enhanced Mode (2),
  20.     DESQview mode         (3); }
  21. implementation
  22.  
  23. function wincheck : integer;
  24. begin
  25.  asm
  26.    mov  ax,   $4680
  27.    int  $2f
  28.    mov  dl,   $1
  29.    or   ax,   ax
  30.    jz   @finished
  31.    mov  ax,   $1600
  32.    int  $2f
  33.    mov  dl,   $2
  34.    or   al,   al
  35.    jz   @Not_Win
  36.    cmp  al,   $80
  37.    jne  @finished
  38.   @Not_Win:
  39.    mov  ax,   $1022
  40.    mov  bx,   $0
  41.    int  $15
  42.    mov  dl,   $3
  43.    cmp  bx,   $0a01
  44.    je   @finished
  45.    xor  dl,   dl
  46.   @finished:
  47.    xor  ah,   ah
  48.    mov  al,   dl
  49.    mov  @Result, ax
  50.  end;
  51. end;
  52.  
  53. begin
  54.    OperatingMode := Wincheck;
  55. end.
  56.  
  57. program Use_Mode;
  58.  
  59. uses
  60.   mode;
  61.  
  62. const
  63.   xModeStringArr : Array[0..3] of string[16] =
  64.      ('Dos Mode', 'Windows Standard', 'Windows Enhanced', 'DESQview Mode');
  65. begin
  66.    Write(xModeStringArr[OperatingMode]);
  67. end.
  68.